package entities;

import util.DataVerify;

public class Customer extends User 
{
	private String pass;
	private String street;
	private String aptno;
	private String zipcode;
	private String state;
	private String city;
	private String country;

	/**
	 * 
	 */
	public Customer() 
	{
		super();
	}

	/**
	 * @param user_name
	 * @param email
	 * @param name
	 * @param lname
	 * @param password
	 * @param pass
	 * @param street
	 * @param aptno
	 * @param zipcode
	 * @param state
	 * @param city
	 * @param country
	 */
	public Customer(String user_name, String email, String name, String lname,
			String password, String pass, String street, String aptno,
			String zipcode, String state, String city, String country) {
		super(user_name, email, name, lname, password);
		this.pass = pass;
		this.street = street;
		this.aptno = aptno;
		this.zipcode = zipcode;
		this.state = state;
		this.city = city;
		this.country = country;
	}

	/**
	 * @return the pass
	 */
	public String getPass() {
		return pass;
	}

	/**
	 * @return the street
	 */
	public String getStreet() {
		return street;
	}

	/**
	 * @return the aptno
	 */
	public String getAptno() {
		return aptno;
	}

	/**
	 * @return the zipcode
	 */
	public String getZipcode() {
		return zipcode;
	}

	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * @param pass the pass to set
	 */
	public void setPass(String pass) {
		this.pass = pass;
	}

	/**
	 * @param street the street to set
	 */
	public void setStreet(String street) {
		this.street = street;
	}

	/**
	 * @param aptno the aptno to set
	 */
	public void setAptno(String aptno) {
		this.aptno = aptno;
	}

	/**
	 * @param zipcode the zipcode to set
	 */
	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @param country the country to set
	 */
	public void setCountry(String country) {
		this.country = country;
	}


	/**
	 * Static initializer.
	 * @param saddr - student address
	 * @param sfname - student first name
	 * @param sgpa - student gpa
	 * @param sid - student id
	 * @param slname - student last name
	 * @param sage - student age
	 */

	public static Customer newInstance(String username, String name, String lastname,
			String email, Long userid, String pass, String street, String aptno,
			String zipcode, String state, String city, String country){
		DataVerify.verifyObject("cusername",username);
		DataVerify.verifyObject("cname",name);
		DataVerify.verifyObject("clastname",lastname);
		DataVerify.verifyObject("cemail",email);
		DataVerify.verifyObject("cuserid",userid);
		DataVerify.verifyObject("cpass",pass);	
		DataVerify.verifyObject("cstreet",street);	
		DataVerify.verifyObject("captno",aptno);
		DataVerify.verifyObject("czipcode",zipcode);
		DataVerify.verifyObject("cstate",state);
		DataVerify.verifyObject("ccity",city);
		DataVerify.verifyObject("ccountry",country);
		return new Customer(username, email, name, lastname,pass, pass, street, aptno, zipcode, state, city, country);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (aptno == null) {
			if (other.aptno != null)
				return false;
		} else if (!aptno.equals(other.aptno))
			return false;
		if (city == null) {
			if (other.city != null)
				return false;
		} else if (!city.equals(other.city))
			return false;
		if (country == null) {
			if (other.country != null)
				return false;
		} else if (!country.equals(other.country))
			return false;
		if (pass == null) {
			if (other.pass != null)
				return false;
		} else if (!pass.equals(other.pass))
			return false;
		if (state == null) {
			if (other.state != null)
				return false;
		} else if (!state.equals(other.state))
			return false;
		if (street == null) {
			if (other.street != null)
				return false;
		} else if (!street.equals(other.street))
			return false;
		if (zipcode == null) {
			if (other.zipcode != null)
				return false;
		} else if (!zipcode.equals(other.zipcode))
			return false;
		return true;
	}


	
}
